﻿using System.Configuration;

namespace iApprove.Configurator
{
    public class BlogSettings: ConfigurationSection
    {
        private static BlogSettings settings =
            ConfigurationManager.GetSection("BlgSettings") as BlogSettings;

        public static BlogSettings Settings
        {
            get { return settings; }
        }

        //public static BlogSettings Settings()
        //{
        //    BlogSettings settings =
        //        ConfigurationManager.GetSection("BlogSettings") as BlogSettings;

        //    if (settings != null)
        //        return settings;

        //    return new BlogSettings();
        //}

        [ConfigurationProperty("frontPagePostCount"
            , DefaultValue = 20
            , IsRequired = false)]
        //[IntegerValidator(MinValue = 1, MaxValue = 100)]              
        public int FrontPagePostCount
        {
            get { return (int)this["frontPagePostCount"]; }
            set { this["frontPagePostCount"] = value; }
        }

        [ConfigurationProperty("title"
            , IsRequired = false)]
        //[StringValidator(
        //     InvalidCharacters = " ~!@#$%^&*(){}[]/;,'\"|\\"
        //    , MinLength = 1,
        //    MaxLength = 20)]
        public string Title
        {
            get { return (string)this["title"]; }
            set { this["title"] = value; }
        }

    }
}
